package CaseDemos;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {
        Random r = new Random();
        int luckNum = r.nextInt(101);

        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入您猜的数字（0-100的整数）：");
            int guessNum = sc.nextInt();
            if (guessNum < luckNum) {
                System.out.println("您猜的数字太小啦！");
            } else if (guessNum > luckNum) {
                System.out.println("您猜的数字太大啦！");
            }else{
                System.out.println("恭喜您猜对了！");
                break;
            }
        }
    }
}
